package com.jml.强软弱虚引用;


import java.lang.ref.WeakReference;

/**
 * @author:jml
 * @date: 2019/5/8 15:43
 * @description：
 */
public class 弱引用 {
    public static void main(String[] args) {
        Object o1 = new Object();
        WeakReference<Object> weakReference = new WeakReference<>(o1);
        System.out.println(o1);
        System.out.println(weakReference.get());
        o1=null;
        System.gc();
        System.out.println(o1);
        System.out.println(weakReference.get());
    }
}
